<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>tab--只读--审查信息--分配专家</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Cache-Control" content="no-siteapp,no-transform,no-store, no-cache, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/weadmin.css">
    <script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
    <style>
        body{
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
            padding-right:60px;
        }
        .layui-table th, .layui-table td {
            text-align: center;
        }
    </style>
</head>
<body>
<p style="font-size: 14px;font-weight: bold;">
    <span>流程当前办理阶段:</span>
    <span class="stage" style="color: #0000FF"></span>
</p>
<div style="padding-left: 30px">
    <p style="font-size: 14px;margin: 20px 0px;">
        <span style="font-weight: bold;">专家列表</span>
    </p>
    <form class="layui-form" action="" lay-filter="example">
        <div class="layui-form-item">
            <label class="layui-form-label">技术负责人</label>
            <div class="layui-input-block">
                <input id="jsfzrId" class="layui-disabled layui-input" disabled value="">
            </div>
        </div>
        <table class="layui-table" lay-filter="example2">
            <colgroup>
                <col>
                <col>
                <col>
            </colgroup>
            <thead>
            <tr class="">
                <th>专业</th>
                <th>审查人</th>
                <th>审核人</th>
            </tr>
            </thead>
            <tbody class="tbodyHtml" id="expertList">
            </tbody>
        </table>
    </form>
    <p style="font-size: 14px;margin: 20px 0px;">
        <span style="font-weight: bold;">政策性审查报告</span>
    </p>
    <form class="layui-form" action="" lay-filter="example1">
        <table class="layui-table">
            <colgroup>
                <col width="150">
                <col width="200">
                <col>
            </colgroup>
            <thead>
            <tr>
                <th>审查人</th>
                <th>审查时间</th>
                <th>审查报告</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>
                    <input id="checkUser" name="checkUser" class="layui-input layui-disabled"
                           style="text-align: center;border: none;" disabled value="">
                </td>
                <td>
                    <input id="checkTime" name="checkTime" class="layui-input layui-disabled"
                           style="text-align: center;border: none;" disabled value="">
                </td>
                <td class="see">查看</td>
            </tr>
            </tbody>
        </table>
    </form>
    <p style="font-size: 14px;margin-bottom: 20px">
        <span style="font-weight: bold;">技术性审查情况</span>
    </p>
    <table class="layui-hide" id="dataList" lay-filter="dataList"></table>
</div>
<script type="text/html" id="barDemo">
    {{#if(d.checkTimes>1){ }}
    <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="opinion">查看</a>
    {{#}}}
</script>
<script type="text/javascript" src="/lib/layui/layui.js"></script>
<script src="/static/js/main.js"></script>
<script>
    var configureCom = {};
    var $;
    var listData = {};
    layui.use(['jquery', 'configureCom', 'configure', 'sessionFun', 'form', 'table', 'matchDict'], function () {
        $ = layui.jquery;
        var configure = layui.configure;
        var form = layui.form;
        var table = layui.table;
        var matchDict = layui.matchDict;
        var sessionFun = layui.sessionFun;
        configureCom = layui.configureCom;
        var stage = sessionFun.get(configure.SESSION_PROJECT_WAIT_LIST_DATA);
        $('.stage').html(stage.taskDefName);
        listData = sessionFun.get(configure.SESSION_PROJECT_WAIT_LIST_DATA);
        //渲染专家下拉框
        configureCom.postDataAjax(configure.EXAMINE_PRICE_TASK_GET_EXPERT_HTTP, {decId: listData.decId}).then(function (res) {
            $('#jsfzrId').val(res.allotExpertList.jsfzrName);
            var nextAll = res.allotExpertList.allotExpertList;
            if (nextAll.length > 0) {
                var html = '';
                $(nextAll).each(function (index, item) {
                    html += '<tr class="formTr">\n' +
                        '            <td class="specialtyName">' + item.specialtyName + '</td>\n' +
                        '            <input name="specialtyId" type="hidden" value="' + item.specialtyId + '">' +
                        '            <td><input value="' + item.exExpertName + '" class="layui-disabled layui-input" disabled></td>\n' +
                        '            <td><input value="' + item.auExpertName + '" class="layui-disabled layui-input" disabled></td>\n' +
                        '        </tr>';
                });
                $('#expertList').html(html);
                var listAll = {
                    jsfzrId: res.allotExpertList.jsfzrId
                };
                form.render('select');
                form.val('example', listAll)
            }
        });
        //保存并提交
        form.on('submit(example)', function (data) {
            return false;
        });
        //政策性审查信息
        configureCom.postDataAjax(configure.EXAMINE_SHOW_POLICY_REPORT_HTTP, {decId: listData.decId}).then(function (res) {
            pastData = {
                checkUser: res.prjPolicyReport.checkUser,//审查人
                checkTime: res.prjPolicyReport.checkTime//审查时间
            };
            form.val('example1', pastData)
        });
        $('.see').on('click', function (obj) {
            configureCom.openPdfSign(configure.CONTRACT_SIGN_ZHENGCE + '?decId=' + listData.decId);
        });
        //技术性审查情况
        var cols = [[
            {
                field: 'specialtyId', title: '专业名称', templet: function (d) {

                    return '<input type="hidden" value="'+ d.specialtyId+'" class="zhuanye"><p>' + matchDict.name(d.specialtyId, configure.ALL_SPE) + '</p>'
                }
            },
            {
                field: 'checkTimes', title: '审查轮数'
            },
            {
                field: 'expertScResult', title: '审查人', templet: function (d) {
                    return '<p>' +d.expertScName +'</p><p style="color: #ccc;">' + matchDict.name(d.expertScResult, configure.RESULT) + '</p><p>'+(d.expertScResultTime || '-') +'</p>';

                }
            },
            {
                field: 'expertShResult', title: '审核人', templet: function (d) {
                    return '<p>' +d.expertShName +'</p><p style="color: #ccc;">' + matchDict.name(d.expertShResult, configure.RESULT) + '</p><p>'+(d.expertShResultTime || '-') +'</p>';
                }
            },
            {
                field: 'leaderResult', title: '技术负责人',width: 200,    templet: function (d) {
                    return '<p>' +d.leaderName +'</p><p style="color: #ccc;">' + matchDict.name(d.leaderResult, configure.RESULT) + '</p><p>'+(d.leaderResultTime || '-') +'</p>';
                }
            },
            { title: '审查意见', toolbar: '#barDemo', width: 150}
        ]];
        //渲染表格
        configureCom.postDataAjax(configure.LEADER_SPEC_RESULT_LIST_HTTP, {decId: listData.decId}).then(function (res) {
            var dataArr = res.prjSpecResultList;
            configureCom.tableRenderUserDefined({}, cols, dataArr, 'dataList', 400);
        });

        //每行操作
        table.on('tool(dataList)', function (obj) {
            var data = obj.data;
            sessionFun.set(configure.SESSION_PROJECT_LIST_DATA, data);
            if (obj.event === 'opinion') {
                top.layer.open({
                    type: 2,
                    area: configureCom.Psize1,
                    content: configureCom.nocache(configure.EXAMINE_EXAMINATION_INFORMATION_HTML),
                    success: function (layero, index) {
                        //top.layer.full(index);
                    }
                });
            }
        });
        form.on('submit(submit)', function (data) {
            return false;
        });
    });

    function getData() {
        return new Promise(function (res, rej) {
            var jsfzrId = $('#jsfzrId').val();//技术负责人
            var listArr = [];
            $('.formTr').each(function (index, item) {
                var specialtyId = $(item).find('[name="specialtyId"]').val();//专业id
                var exExpertId = $(item).find('[name="exExpertId"]').val();//审查人专家id
                var auExpertId = $(item).find('[name="auExpertId"]').val();//审核人专家id
                var listData = {
                    specialtyId: specialtyId,
                    exExpertId: exExpertId,
                    auExpertId: auExpertId
                };
                listArr.push(listData);
            });
            var formData = {
                jsfzrId: jsfzrId,
                allotExpertList: listArr
            };
            res({result: formData});
        });
    }
</script>
</body>
</html>